{layout name="main"/}
<div class="wrapper wrapper-content animated fadeInUp">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">

                <div class="ibox-title">
                    <h5>货币流向列表</h5>

                </div>

                <div class="ibox-content">
                    <div class="row m-b-sm m-t-sm">
                        <div class="col-sm-4">
                            <div class="input-daterange input-group" id="datepicker">
                                <input type="text" class="input-sm form-control" name="startdate" placeholder="开始时间" value="{$startdate}" />
                                <span class="input-group-addon">到</span>
                                <input type="text" class="input-sm form-control" name="enddate" placeholder="结束时间" value="{$enddate}" />
                            </div>
                        </div>
                        <div class="col-sm-5">
                            <div class="btn-group">
                                <a href="{:url('admin/Money/moneyList')}" class="btn {if condition=" $cash_flow_type==-1 "}btn-primary{else}btn-white{/if} btn-sm" type="button">全部</a>
                                <a href="{:url('admin/Money/moneyList',['cash_flow_type'=>2])}" class="btn {if condition=" $cash_flow_type==2 "}btn-primary{else}btn-white{/if} btn-sm" type="button">出局奖</a>
                                <a href="{:url('admin/Money/moneyList',['cash_flow_type'=>0])}" class="btn {if condition=" $cash_flow_type==0 "}btn-primary{else}btn-white{/if} btn-sm" type="button">推荐奖</a>
                                <a href="{:url('admin/Money/moneyList',['cash_flow_type'=>4])}" class="btn {if condition=" $cash_flow_type==4 "}btn-primary{else}btn-white{/if} btn-sm" type="button">财富币奖</a>
                                <a href="{:url('admin/Money/moneyList',['cash_flow_type'=>3])}" class="btn {if condition=" $cash_flow_type==3 "}btn-primary{else}btn-white{/if} btn-sm" type="button">奖金提现</a>
                                <a href="{:url('admin/Money/moneyList',['cash_flow_type'=>1])}" class="btn {if condition=" $cash_flow_type==1 "}btn-primary{else}btn-white{/if} btn-sm" type="button">货币充值</a>
                                <a href="{:url('admin/Money/moneyList',['cash_flow_type'=>5])}" class="btn {if condition=" $cash_flow_type==5 "}btn-primary{else}btn-white{/if} btn-sm" type="button">消费</a>
							</div>
                        </div>
                        <div class="col-sm-3">


                            <div class="input-group">
                                <input type="text" placeholder="搜索(会员编号,会员昵称)" class="input-sm form-control" name="keyword" value="{$keyword}"> <span class="input-group-btn">
                                    <button type="button" class="btn btn-sm btn-primary" onclick="search()">搜索</button> </span>
                            </div>
                        </div>
                    </div>
                    <div class="project-list">
                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
                            <thead>
                                <tr role="row">

                                    <th style="width: 15%;">会员编号/昵称</th>
                                    <th style="width: 5%;">金额</th>
                                    <th style="width: 10%;">类型</th>
                                    <th style="width: 15%;">操作时间</th>
                                    <th>备注</th>
                                </tr>
                            </thead>

                            <!--                            <tbody><tr class="no-records-found"><td colspan="8">没有找到匹配的记录</td></tr></tbody>-->

                            <tbody>


                              {:table_empty_list($list,'暂无数据!',5)}
                                {volist name="list" id="cash_flow"}
                                <tr class="gradeA">

                                    <td>{$cash_flow->target_user->user_uniid}/{$cash_flow->target_user->user_name}</td>
                                    <td>{$cash_flow->cash_value}</td>
                                    <td>{$cash_flow->cash_flow_type}{if condition="$cash_flow->cash_flow_type=='奖金'"}:{$cash_flow->sub->award_type}{/if}</td>
                                    <td>{$cash_flow->create_time}</td>
                                    <td>{switch name="$cash_flow->cash_flow_type"} {case value="奖金"}奖金：{/case} {case value="充值"}充值类型：{$cash_flow->cash_type} 操作人：{$cash_flow->confirmed_user->user_name}。{/case} {case value="提现"}提现信息：{$cash_flow->sub->card->card_sub_bank}
                                        {$cash_flow->sub->card->card_number} {$cash_flow->sub->card->card_name} 操作人：{$cash_flow->confirmed_user->user_name}。{/case} {/switch}{$cash_flow->cash_flow_comments}
                                    </td>

                                </tr>
                                {/volist}
                            </tbody>

                        </table>

                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="dataTables_info" id="DataTables_Table_0_info" role="alert" aria-live="polite" aria-relevant="all">
                                每页显示 {:getPageSize()} 项，共 {$list->toArray()['total']} 项 {if condition="$cash_flow_type!=-1"}
                                <label style="color:red; padding-left: 10px; font-weight: normal">[总金额：{$count}元]</label>{/if}
                            </div>


                        </div>
                        <div class="col-sm-6">
                            <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
                                {$list->render()}

                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>

        <script>
            $(".input-daterange").datepicker({
                keyboardNavigation: !1,
                forceParse: !1,
                autoclose: !0
            });


            function search() {
                var url = "{:url('admin/Money/moneyList', ['cash_flow_type'=>$cash_flow_type],'')}";
                var startdate = $("input[name=startdate]").val();
                var enddate = $("input[name=enddate]").val();
                if (startdate != "") {
                    url = url + "/startdate/" + startdate;
                }
                if (enddate != "") {
                    url = url + "/enddate/" + enddate;
                }
                var keyword = $("input[name=keyword]").val();
                if (keyword != "") {
                    url = url + "/keyword/" + keyword;
                }
                toUrl(url);
            }
        </script>
